<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			div {
				width: 50px;
				height: 50px;
				background-color: pink;
			}
		</style>
		<script type="text/javascript" src="fastclick.js">

		</script>
	</head>
	<body>
		<div>

		</div>
		<script type="text/javascript">
			//移动端的点击事件默认有300ms延迟,使用fastclick可以取消300ms延迟
			//判断document是否有addEventListener
			if ('addEventListener' in document) {
				//DOMContentLoaded页面中的dom元素加载完之后执行,比load更优先执行
				document.addEventListener('DOMContentLoaded', function() {
					FastClick.attach(document.body);
				}, false);
			}

			var div = document.querySelector('div');
			div.addEventListener('click', function() {
				alert('dslkfj')
			})
		</script>
	</body>
</html>
